/*
 *  Copyright 2005 Blandware (http://www.blandware.com)
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package com.blandware.atleap.service.core.util;

import org.apache.commons.lang.builder.ToStringBuilder;

import java.io.Serializable;
import java.util.Date;
import java.util.Map;

/**
 * <p>Represents a raw data which can be extracted rather fast and later
 * processed in a batch.</p>
 * <p><a href="RawData.java.html"><i>View source</i></a></p>
 *
 * @author Roman Puchkovskiy <a href="mailto:roman.puchkovskiy@blandware.com">
 *         &lt;roman.puchkovskiy@blandware.com&gt;</a>
 * @version $Revision: 1.4 $ $Date: 2006/08/20 14:39:43 $
 */
public class RawData implements Serializable {

    protected String url;
    protected String path;
    protected String pageUri;
    protected String contentResourceUri;
    protected String referrerUrl;
    protected String referrerDomain;
    protected Map referrerQueryParameters;
    protected Integer sessionNumber;
    protected Integer visitorNumber;
    protected String ip;
    protected String userAgent;
    protected String userName;
    protected String screenInfo;
    protected Date date;

    /**
     * Returns URL.
     *
     * @return URL
     */
    public String getUrl() {
        return url;
    }

    /**
     * Sets URL.
     *
     * @param url URL to set
     */
    public void setUrl(String url) {
        this.url = url;
    }

    /**
     * Returns URL path.
     *
     * @return path
     */
    public String getPath() {
        return path;
    }

    /**
     * Sets URL path.
     *
     * @param path path to set
     */
    public void setPath(String path) {
        this.path = path;
    }

    /**
     * Returns page URI.
     *
     * @return page URI
     */
    public String getPageUri() {
        return pageUri;
    }

    /**
     * Sets page URI.
     *
     * @param pageUri URI to set
     */
    public void setPageUri(String pageUri) {
        this.pageUri = pageUri;
    }

    /**
     * Returns content resource URI.
     *
     * @return content resource URI
     */
    public String getContentResourceUri() {
        return contentResourceUri;
    }

    /**
     * Sets content resource URI.
     *
     * @param contentResourceUri URI to set
     */
    public void setContentResourceUri(String contentResourceUri) {
        this.contentResourceUri = contentResourceUri;
    }

    /**
     * Returns referrer URL.
     *
     * @return referrer URL
     */
    public String getReferrerUrl() {
        return referrerUrl;
    }

    /**
     * Sets referrer URL.
     *
     * @param referrerUrl URL to set
     */
    public void setReferrerUrl(String referrerUrl) {
        this.referrerUrl = referrerUrl;
    }

    /**
     * Returns referrer domain.
     *
     * @return referrer domain
     */
    public String getReferrerDomain() {
        return referrerDomain;
    }

    /**
     * Sets referrer domain.
     *
     * @param referrerDomain domain to set
     */
    public void setReferrerDomain(String referrerDomain) {
        this.referrerDomain = referrerDomain;
    }

    /**
     * Returns referrer query parameters map (values are URL-encoded).
     *
     * @return referrer query parameters map
     */
    public Map getReferrerQueryParameters() {
        return referrerQueryParameters;
    }

    /**
     * Sets referrer query parameters map (values are URL-encoded).
     *
     * @param referrerQueryParameters map to set
     */
    public void setReferrerQueryParameters(Map referrerQueryParameters) {
        this.referrerQueryParameters = referrerQueryParameters;
    }

    /**
     * Returns session number.
     *
     * @return session number
     */
    public Integer getSessionNumber() {
        return sessionNumber;
    }

    /**
     * Sets session number.
     *
     * @param sessionNumber number to set
     */
    public void setSessionNumber(Integer sessionNumber) {
        this.sessionNumber = sessionNumber;
    }

    /**
     * Returns visitor number.
     *
     * @return visitor number
     */
    public Integer getVisitorNumber() {
        return visitorNumber;
    }

    /**
     * Sets visitor number.
     *
     * @param visitorNumber number to set
     */
    public void setVisitorNumber(Integer visitorNumber) {
        this.visitorNumber = visitorNumber;
    }

    /**
     * Returns IP address.
     *
     * @return IP
     */
    public String getIp() {
        return ip;
    }

    /**
     * Sets IP address.
     *
     * @param ip IP to set
     */
    public void setIp(String ip) {
        this.ip = ip;
    }

    /**
     * Returns user agent string.
     *
     * @return user agent string
     */
    public String getUserAgent() {
        return userAgent;
    }

    /**
     * Sets user agent string.
     *
     * @param userAgent string to set
     */
    public void setUserAgent(String userAgent) {
        this.userAgent = userAgent;
    }

    /**
     * Returns user name.
     *
     * @return user name
     */
    public String getUserName() {
        return userName;
    }

    /**
     * Sets user name.
     *
     * @param userName name to set
     */
    public void setUserName(String userName) {
        this.userName = userName;
    }

    /**
     * Returns string containing screen info.
     *
     * @return screen info
     */
    public String getScreenInfo() {
        return screenInfo;
    }

    /**
     * Sets string containing screen info
     *
     * @param screenInfo string to set
     */
    public void setScreenInfo(String screenInfo) {
        this.screenInfo = screenInfo;
    }

    /**
     * Returns date.
     *
     * @return date
     */
    public Date getDate() {
        return date;
    }

    /**
     * Sets date.
     *
     * @param date date to set
     */
    public void setDate(Date date) {
        this.date = date;
    }

    /**
     * Returns <code>true</code> if something was visited which is not a
     * resource.
     *
     * @return true if not resource
     */
    public boolean isNotResource() {
        return getContentResourceUri() == null;
    }

	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
}
